<script lang="ts">
export default{
  setup(){
    let num:number=10;

    function getNum(){
      console.log('点击')
      console.log(num)  //不用写this
    }

    return{
      num,
      getNum
    }
  }
}
</script>

<template >
这是index1
  {{num}}
  <button @click="getNum">getNum</button>
</template>

<style scoped lang="less">

</style>
